    /*  
    championBuilder - Champions Online character planner.
    Copyright (C) 2009 Moritz Hartmeier
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You can find the GNU General Public License in the data folder.
    */


package ch.zarzu.champions.builder;

import java.awt.Color;
import java.io.File;

import ch.zarzu.util.AppPath;

public class App {
    public final static Color DARK_BLUE = new Color(20, 93, 143);
    public final static Color VERY_DARK_BLUE = new Color(7, 36, 56);
    public final static Color LIGHT_BLUE = new Color(11, 139, 226);
    public final static Color VERY_LIGHT_BLUE = new Color(129, 198, 244);
    public final static Color GREY = new Color(39, 48, 65);
    public final static Color ORANGE = new Color(254, 162, 1);
    
    public final static double SCALE = 0.85;
    
    public final static String VERSION = "0.5.0";
    
    public final static boolean IS_DEV = false;
            //new Boolean(System.getProperty("champions.builder.dev", "false"));
    private final static String OPERATING_SYSTEM = 
            System.getProperty("os.name").toLowerCase();
    public final static boolean IS_OSX = OPERATING_SYSTEM.startsWith("mac");
    public final static boolean IS_WINDOWS = OPERATING_SYSTEM.contains("windows");
    public final static boolean IS_LINUX = (!App.IS_OSX && !App.IS_WINDOWS);
    
    public final static String DIST = "exe";
    //public final static String DIST = "jar5";
    public final static boolean not_app = true;
    
    public static Color background = LIGHT_BLUE;
    private static String writeableDir = null;
    
    public static void setBackground(Color color) {
        background = color;
    }
    
    public static String getWriteableDirectory() {
        if (writeableDir == null) {
            String default_path = javax.swing.filechooser.FileSystemView
                    .getFileSystemView().getDefaultDirectory().getAbsolutePath()
                     + File.pathSeparator;
            String appPath = AppPath.get();
            String dir;
            File temp = new File(appPath + "temp");
            temp.mkdir();
            if (new File(appPath + "temp").exists()) {
                dir = appPath + "data" + File.pathSeparator;
            } else {
                dir = default_path + "championBuilder" + File.pathSeparator;
            }
            temp.delete();
            dir = appPath + "data/";
            
            writeableDir = dir;
        }
        
        return writeableDir;
    }
}
